﻿using System;
using System.Web;
using System.Web.Security;
using log4net;

namespace Cognitum.Presentacion
{
    public partial class x : System.Web.UI.Page
    {
        private static ILog LOG = LogManager.GetLogger(typeof(x));

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (LOG.IsDebugEnabled)
                {
                    LOG.Debug(string.Format("Renewing ticket, current session timeout [{0}]", Context.Session.Timeout));
                }
                var principal = HttpContext.Current.User;
                var identity = (FormsIdentity)principal.Identity;
                FormsAuthentication.RenewTicketIfOld(identity.Ticket);
                if (LOG.IsDebugEnabled)
                {
                    LOG.Debug(string.Format("Ticket renewed, new timeout [{0}]", Context.Session.Timeout));
                }
            }
        }
    }
}
